﻿
using System;
using System.Collections.Generic;

namespace LxCFD
{
    public class InitializationGroup : GroupBase
    {
        public List<IInitializable> Initialization_Normal6 = new List<IInitializable>();
        public List<IInitializable> Initialization_Transient9 = new List<IInitializable>();
        public override void Clear()
        {
            base.Clear();
            Initialization_Normal6.Clear();
            Initialization_Transient9.Clear();
        }
        public void Initialize(bool isForce)
        {
            initialize(isForce, Initialization_Normal6);
            initialize(isForce, Initialization_Transient9);
        }
        protected void initialize(bool isForce, List<IInitializable> iniGroup)
        {
            foreach (var ini in iniGroup)
            {
                if (isForce || !ini.GetIsInitialized())
                {
                    ini.Initialize();
                    ini.SetIsInitialized(true);
                }
        
            }
        }

    }
}
//if (isForce || !ini.IsInitialized())
//{
//    MultiTask.RunCalTasks(ini.Initialize);
//    ini.SetInitialized();
//}
//ini.Initialize(taskIndex);
//MultiTask.Sync(taskIndex, ini.SetInitialized);